/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pos.Driving.Path;

import javax.media.j3d.TransformGroup;
import pos.Driving.Train.Train;

/**
 *
 * @author Administrator
 */
public class Sideway extends TransformGroup implements Attachable{
    private int pathidA,pathidAs, pathidB, pathidBs;
    private boolean isSidewayA, isSidewayB;
    private double D;
    private PosPoint P;

    public Sideway(int pathidA, int pathidAs, int pathidB, int pathidBs) {
        this.pathidA = pathidA;
        this.pathidAs = pathidAs;
        this.pathidB = pathidB;
        this.pathidBs = pathidBs;
        this.isSidewayA=false;
        this.isSidewayB=false;
    }
    
    public void choosePath(PosPoint pos){
        double delta=pos.d-D;
        if (delta>=0 && delta<5){
            if (isSidewayB)
                pos.path_ID=pathidBs;
            else
                pos.path_ID=pathidB;
        }
        else if(delta>-5 && delta<0){
            if (isSidewayA)
                pos.path_ID=pathidAs;
            else
                pos.path_ID=pathidA;
        }
    }

    public void setIsSidewayA(boolean isSidewayA) {
        this.isSidewayA = isSidewayA;
    }

    public void setIsSidewayB(boolean isSidewayB) {
        this.isSidewayB = isSidewayB;
    }
    
    @Override
    public void setLocation(double d, PosPoint p) {
        D=d;
        P=p;
    }

    @Override
    public Object action(Train train) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
    @Override
    public Object getInfo() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public Object setParam(Object param) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public boolean test(double d) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

}
